package cn.cvs.service.forum;

import cn.cvs.dao.forum.ForumMapper;
import cn.cvs.pojo.Comment;
import cn.cvs.pojo.Forum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class ForumServiceImpl implements  ForumService {

    @Autowired
    private ForumMapper forumMapper;

    @Override
    public List<Forum> list(int pageIndex, int pageSize) {
        int pageBegin = (pageIndex-1)*pageSize;
        return forumMapper.list(pageBegin,pageSize);
    }

    @Override
    public int getCount() {
        return forumMapper.getCount();
    }

    @Override
    public int addForum(Forum forum) {
        return forumMapper.addForum(forum);
    }

    @Override
    public Forum getForumById(Integer id) {
        return forumMapper.getForumById(id);
    }

    @Override
    public List<Forum> listPage(Integer state, Integer pageIndex, Integer pageSize) {
        int pageBean = (pageIndex - 1) * pageSize;
        return forumMapper.listPage(state,pageBean,pageSize);
    }

    @Override
    public int count(Integer state) {
        return forumMapper.count(state);
    }

    @Override
    public Forum selectById(Integer id) {
        return forumMapper.selectById(id);
    }

    @Override
    public int updateById(Forum forum) {
        return forumMapper.updateById(forum);
    }


}
